class Solution
{
public:
    int partitionString(string s)
    {
        int count = 0;
        int mask = 0;
        for (char c : s)
        {
            int thisCharMask = 1 << (c - 'a');
            if (thisCharMask & mask)
            {
                ++count;
                mask = thisCharMask;
            }
            else
            {
                mask |= thisCharMask;
            }
        }
        return count + 1;
    }
};